
<%@ page import="com.pilates.Matricula" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'matricula.label', default: 'Matricula')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
        <script type="text/javascript">
	        function experimentalClick(cmp){
            if(cmp.checked == true){
            	$("#dataExp1").show();
            	$("#dataExp2").show();
            }else{
            	$("#dataExp1").hide();
            	$("#dataExp2").hide();
            }
        }
	        
	        $(document).ready(function() {
	             experimentalClick(document.getElementById("experimental"));
	        	 $('#container-1').tabs({ fxFade: false, fxSpeed: 'fast' }); 
	        });
        </script>
        
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${matriculaInstance}">
            <div class="errors">
                <g:renderErrors bean="${matriculaInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${matriculaInstance?.id}" />
                <g:hiddenField name="version" value="${matriculaInstance?.version}" />
                 <table>
                    <tbody>
                       <tr class="prop">
                           <td valign="top" class="name">
                             <label for="pessoa"> <g:message code="matricula.pessoa.label" default="Pessoa" /></label>
                           </td>
                           <td valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'pessoa', 'errors')}">
                               <g:select name="pessoa.id" from="${com.pilates.Pessoa.list()}" optionKey="id" value="${matriculaInstance?.pessoa?.id}"  />
                           </td>
                       </tr>
                 	</tbody>
                 </table>
                <div class="dialog">
                        <div id="container-1" class="myAba">
				            <ul>
				                <li><a href="#fragment-1"><span>Cadastro</span></a></li>
                        
                           		<li><a href="#fragment-2"><span><g:message code="matricula.presencas.label" default="Presencas" /></span></a></li>
                                		
                            	</ul>
                         
                            	<div id="fragment-1" >
                            	 <table>
                        			<tbody>
                            
				                           <tr class="prop">
				                                <td valign="top" class="name">
				                                  <label for="turma"> <g:message code="matricula.turma.label" default="Turma" /></label>
				                                </td>
				                                <td valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'turma', 'errors')}">
				                                    <g:select name="turma.id" from="${com.pilates.Turma.list()}" optionKey="id" value="${matriculaInstance?.turma?.id}"  />
				                                </td>
				                            </tr>
				                        
				                            <tr class="prop">
				                                <td valign="top" class="name">
				                                  <label for="dataInicio"> <g:message code="matricula.dataInicio.label" default="Data Inicio" /></label>
				                                </td>
				                                <td valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'dataInicio', 'errors')}">
				                                    <g:datePicker name="dataInicio" precision="day" value="${matriculaInstance?.dataInicio}"  />
				                                </td>
				                            </tr>
				                        
				                            <tr class="prop">
				                                <td valign="top" class="name">
				                                  <label for="experimental"> <g:message code="matricula.experimental.label" default="Experimental" /></label>
				                                </td>
				                                <td valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'experimental', 'errors')}">
				                                    <g:checkBox name="experimental" value="${matriculaInstance?.experimental}" onclick="experimentalClick(this);"/>
				                                </td>
				                            </tr>
				                        
				                            <tr class="prop">
				                                <td  valign="top" class="name">
				                                	<div id="dataExp1">
				                                    <label for="data"><g:message code="matricula.data.label" default="Data" /></label>
				                                    </div>
				                                </td>
				                                <td  valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'data', 'errors')}">
				                                    <div id="dataExp2">
				                                    <g:datePicker name="data" precision="day" value="${matriculaInstance?.data}" noSelection="['': '']" />
				                                    </div>
				                                </td>
				                            </tr>
				                            <tr class="prop">
				                                <td valign="top" class="name">
				                                  <label for="ativo"> <g:message code="matricula.ativo.label" default="Ativo" /></label>
				                                </td>
				                                <td valign="top" class="value ${hasErrors(bean: matriculaInstance, field: 'ativo', 'errors')}">
				                                    <g:select name="ativo" from="${com.pilates.types.TypeAtivo?.values()}" value="${matriculaInstance?.ativo}"  />
				                                </td>
				                            </tr>
				                        
				                            
                        
                            			 </tbody>
                    					</table>
                            			</div>
                                		<div id="fragment-2" class="myAba">
                            				<ul>
											<g:each in="${matriculaInstance?.presencas?}" var="p">
											    <li><g:link controller="presenca" action="edit" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
											</g:each>
											</ul>
											<g:link controller="presenca" action="create" params="['matricula.id': matriculaInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'presenca.label', default: 'Presenca')])}</g:link>
							            </div>
                                		
                       
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
